@extends('admin.layout.main')

@section('content')
    <div class="breadcrumbs ace-save-state" id="breadcrumbs">
        <ul class="breadcrumb">
            <li>
                <i class="ace-icon fa fa-home home-icon"></i>
                <a href="#">售后服务</a>
            </li>
            <li class="active"><a href="#">申诉详情</a></li>
        </ul><!-- /.breadcrumb -->

        <div class="nav-search" id="nav-search">
            <form class="form-search">
		<span class="input-icon">
		<input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
			<i class="ace-icon fa fa-search nav-search-icon"></i>
		</span>
            </form>
        </div><!-- /.nav-search -->
    </div>

    <div class="row">
        <div class="col-xs-12">
        	<!-- 申诉内容 -->
			<div class="table-header">
				<a href="#">
				<span class="menu-text orange"> 申诉详情 </span>
				</a>
			</div>
            <div>
				<table id="dynamic-table" class="table table-striped table-bordered table-hover">
					<tbody>	
						<tr>
							<td class="center">
								<span>* 申诉人 </span>
							</td>
							<td>
								{{$data->user->nickname}}
							</td>
							<td class="center">
								<span>* 联系方式 </span>
							</td>
							<td>
								{{$data->user->phone ?? $data->user->email}}
							</td>
							<td class="center">
								<span>* 订单编号 </span>
							</td>
							<td>
								{{$data->recharge->order_no}}
							</td>
							<td class="center">
								<span>* 订单类型</span>
							</td>
							<td>
								{{\App\Models\Recharge::$TYPE[$data->recharge->type]}}USDT
							</td>
							<td class="center">
								<span>* 订单金额</span>
							</td>
							<td>
								{{$data->recharge->total_price}}
							</td>
						</tr>	
					
						<tr>
							<td class="center">
								<span>* 申诉类型</span>
							</td>
							<td>
								{{\App\Models\Appeal::$TYPE[$data->type]}}
							</td>
							<td class="center"> 
								<span>* 申诉内容</span>
							</td>
							<td colspan="7">
								{{$data->content}}
							</td>
						</tr>	

						<tr>
							<td class="center"> 
								<span>* 申诉图片</span>
							</td>
							<td colspan="9">
								@if(collect($data->appeal_imgs)->count() > 0)
									@foreach($data->appeal_imgs as $img)
										<img src="{{config('alioss.host').$img->img}}" style="width:200px;height: 100px;">
									@endforeach
								@endif
							</td>
						</tr>	
					</tbody>
				</table>
			</div>
			<!--申诉回复内容-->
			<div class="table-header">
				<a href="#">
				<span class="menu-text orange"> 回复详情 </span>
				</a>
			</div>
            <!-- PAGE CONTENT BEGINS -->
            <div>
				<table id="dynamic-table" class="table table-striped table-bordered table-hover">	
					<tbody>
						@if(collect($data->appeal_reply)->count() > 0)	
						<tr>
							<td class="center"> 
								<span>* 被申诉人</span>
							</td>
							<td>
								{{$data->appeal_reply->user->nickname}}
							</td>
						</tr>
						<tr>
							<td class="center"> 
								<span>* 回复内容</span>
							</td>
							<td>
								{{$data->appeal_reply->content}}
							</td>
						</tr>
						<tr>
							<td class="center"> 
								<span>* 回复图片</span>
							</td>
							<td colspan="9">
								@if(collect($data->appeal_reply->appeal_reply_imgs)->count() > 0)
									@foreach($data->appeal_reply->appeal_reply_imgs as $img)
										<img src="{{config('alioss.host').$img->img}}" style="width:200px;height: 100px;">
									@endforeach
								@endif
							</td>
						</tr>
						@endif
					</tbody>		
				</table>
			</div>
			<!--申诉仲裁结果-->
			@if(in_array($data->status, [0, 1]))
			<div class="table-header">
				<a href="#">
				<span class="menu-text orange"> 仲裁 </span>
				</a>
			</div>
			<div>
				<form class="form-horizontal" role="form" action="/admin/save_arbitration" method="post">
					<table id="dynamic-table" class="table table-striped table-bordered table-hover">
						{{csrf_field()}}
						<tbody>
							<input type="hidden" name="appeal_id" value="{{$data->getKey()}}">
							<tr>
								<td class="center"> 
									<span>* 处理意见</span>
								</td>
								<td>
									<select name="status" style="width: 300px;">
										<option value="0">请选择一个仲裁结果</option>
										<option value="2">判定申诉方胜出</option>
										<option value="3">判定被申诉方胜出</option>
									</select>
								</td>
							</tr>
							<tr>
								<td class="center"> 
									<span>* 备注</span>
								</td>
								<td>
									<input type="text" name="note" class="col-xs-12">
								</td>
							</tr>	
							<tr>
								<td></td>
								<td>
									<button class="btn btn-info btn-xs" type="submit">
			                            <i class="ace-icon fa fa-check bigger-110"></i>
			                            提交
			                        </button>

			                        &nbsp; &nbsp; &nbsp;
			                        <a href="javascript:history.go(-1);" class="btn btn-xs" type="reset">
			                            <i class="ace-icon fa fa-undo bigger-110"></i>
			                            返回
			                        </a>
								</td>
							</tr>	
						</tbody>
					</table>
            	</form>
            </div>
            @else
				@if($data->status==2)
					<h1 class="center">仲裁结果：申诉方胜出！</h1>
				@endif
				@if($data->status==3)
					<h1 class="center">仲裁结果：被申诉方胜出！</h1>
				@endif
            @endif
        </div>
    </div>
    </div><!-- /.main-content -->
@endsection

@section('after.js')

@endsection
